﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Pp.Dto.WallItem>" %>

<%@ Import Namespace="Pp.Core.Extentions" %>
<%@ Import Namespace="Pp.UI.Models" %>
<%@ Import Namespace="Pp.Globalization" %>
<%@ Import Namespace="Pp.Dto" %>
<asp:Content ID="Content1" ContentPlaceHolderID="LeftWall" runat="server">
 
    <div class="cvInformation">
        <div class="otherInfo">
            <p>
                <%=string.IsNullOrEmpty(Server.HtmlDecode(Model.Detail.CvInfo ?? "").Trim()) ? Res.Message_CV : Server.HtmlDecode(Model.Detail.CvInfo)%></p>
        </div>
    </div>
    <div class="last-notification">
        <%foreach (var likeDto in Model.MyLikes)
          {%>
          {%>
        <div class="Son-Begeniler">
            <p class="p-like-notice">
                <%=likeDto.ToNotification(Model.IsMyProfile,false)%></p>
        </div>
        <%} %>
    </div>
    <script>
        $(document).ready(function () {
            $(".last-notification").dialog({ autoOpen: false, title: '<%=Res.Label_LastLiked %>', width: 400, height: 600 });
            $(".cvInformation").dialog({ autoOpen: false, title: '<%=Res.Label_CvInfo %>', width: 500, height: 600 });
        });
 
    </script>
    <h2>
        <%=Model.Detail.GetFullName()  %></h2>
    <img class="profile-img" width="200" style="margin-bottom: 0;" title="<%=Model.Detail.GetFullName() %>"
        src="<%=Model.Detail.Picture.ExistImage(Server,ImageType.Profile) %>" />
    <p class="textLeft">
        <b>
            <%=Res.Label_Sector %>
            :</b>
        <%=string.IsNullOrEmpty(Server.HtmlDecode(Model.Detail.WorkInfo ?? "").Trim()) ? Res.Message_Work: Server.HtmlDecode(Model.Detail.WorkInfo)%></p>
    <p class="textLeft">
        <b>
            <%=Res.Label_Educational %>
            :</b>
        <%=string.IsNullOrEmpty(Server.HtmlDecode(Model.Detail.EducationalInfo ?? "").Trim()) ? Res.Message_Educational : Server.HtmlDecode(Model.Detail.EducationalInfo)%></p>
    <p class="texleft">
        <b>
            <%=Res.Label_City %>
            :</b>
        <%=Model.Detail.City %>
    </p>
    <p class="texleft">
        <b>
            <%=Res.Label_Total_Project %></b>
        <%=Model.Projects.Count %>
    </p>
    <ul class="Profil_Menu <%=Model.IsMyProfile %>">
        <%if (Model.IsMyProfile)
          {%>
        <li class="NewProjectUrl"><a href="<%: Url.Action("New", "Project")%>"><span>
            <img src="/Content/themes/Theme2/images/newproject.png" />
        </span>
            <%=Res.Label_NewProject%>
        </a></li>
        <li class="UpdateProfileUrl"><a href="<%: Url.Action("Update", "Account")%>"><span>
            <img src="/Content/themes/Theme2/images/edit_profile.png" /></span>
            <%=Res.Label_ProfileEdit %></a></li>
        <li><a href="<%: Url.Action("ChangePassword", "Account")%>"><span>
            <img src="/Content/themes/Theme2/images/user_pass.png" /></span>
            <%=Res.Label_PasswordEdit%>
        </a></li>
        <%}
          else
          {%>
        <%} %>
        <li class="CVInformation" disabled="<%=string.IsNullOrEmpty((Model.Detail.CvInfo?? "").Trim()) %>">
            <a onclick="$('.cvInformation').dialog('open');"><span>
                <img src="/Content/themes/Theme2/images/browseusers.png" /></span>
                <%=Res.Label_CvInfo%></a></li>
        <li class="LastNotification"><a onclick="$('.last-notification').dialog('open');"><span>
            <img src="/Content/themes/Theme2/images/blogadd.png" /></span>
            <%=Res.Label_LastLiked%></a></li>
    </ul>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MiddleWall" runat="server">
    <h2>
        <%=Res.Label_LastProject_Count.FormatWith(3) %></h2>
    <%if (Model.Projects.Count() == 0 && Model.IsMyProfile)
      {%>
    <p style="text-align: center; font-size: 13pt">
        <%=Res.Message_Project%></p>
    <p style="text-align: center; font-size: 13pt">
        <span>
            <%=Res.Message_Sahare_First_Project.FormatWith("<a href='/Project/New'>", "</a>.")%></span></p>
    <%}%>
    <%foreach (var projectDto in Model.Projects)
      {%>
    <%Html.RenderPartial("ProjectView", projectDto);%>
    <%} %>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="RightWall" runat="server">
    <%if (!Model.IsMyProfile && Request.IsAuthenticated)
      {%>
    <ul class="like-follow">
        <li>
            <%Html.RenderPartial("Like", new MLike
                                                  {
                                                      Id = Model.Detail.Id,
                                                      Like = Model.TheyLikes.Where(d => d.UserDetail.Username == User.Identity.Name).Count() == 0,
                                                      LikeType = LikeType.Profile,
                                                      ChangeCount = ".likeCount"

                                                  });%>
        </li>
        <li>
            <%Html.RenderPartial("Follow", new FollowItem
                                              {
                                                  FollowType = FollowType.Profile,
                                                  Id = Model.Detail.Id,
                                                  FollowCount = ".followCount",
                                                  IsFollow = Model.Detail.ProfileFollowers.Where(d => d.Follower.Username == User.Identity.Name).Count() == 0
                                              }); %>
        </li>
    </ul>
    <%}%>
    <div class="popularites">
        <h4 class="pink">
            <%=Res.Title_Followers%>
            <a class="followCount">
                <%=Model.Detail.ProfileFollowers.Count()%>
            </a>
        </h4 >
        <%Html.RenderPartial("UserSmallList", Model.Detail.ProfileFollowers.Select(d => d.Follower).ToList()); %>
    </div>
    <div class="popularites">
        <h4 class="pink">
            <%=Res.Title_Likes %>
            <a class="likeCount">
                <%=Model.TheyLikes.Count()%></a></h4>
        <%Html.RenderPartial("UserSmallList", Model.TheyLikes.Select(d => d.UserDetail).ToList()); %>
    </div>
</asp:Content>
